package com.onesports.intelligent.k12.polarlight.common.converter;

import com.onesports.framework.kit.common.util.BeanUtils;
import com.onesports.intelligent.k12.polarlight.domain.dto.sys.DictDTO;
import com.onesports.intelligent.k12.polarlight.domain.entity.sys.Dict;
import com.onesports.intelligent.k12.polarlight.domain.vo.sys.SysDictVO;
import org.springframework.stereotype.Component;

@Component
public class SysDictConverter {
    public SysDictVO toVO(Dict dict) {
        if (dict == null) {
            return null;
        } else {
            return BeanUtils.copyProperties(dict,SysDictVO.class);
        }
    }

    public Dict dictDtoToDict(DictDTO dictDTO) {
        if (dictDTO == null) {
            return null;
        } else {
            Dict dict = new Dict();
            dict.setId(dictDTO.getId());
            dict.setName(dictDTO.getName());
            dict.setCode(dictDTO.getCode());
            dict.setRemarks(dictDTO.getRemarks());
            dict.setSort(dictDTO.getSort());
            return dict;
        }
    }
}
